package com.example.linktop.uiwidgetdemo;

import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class FirstActivity extends AppCompatActivity {

    private TextView tv_hello;
    private ImageView img;
    private Button btn;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_first);


        tv_hello = (TextView)findViewById(R.id.tv_hello);
        img = (ImageView)findViewById(R.id.img);
//        img.setImageResource(R.drawable.1);

        img.getVisibility();
        btn = (Button)findViewById(R.id.btn1);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                //跳出一个dialog
                AlertDialog.Builder alert = new AlertDialog.Builder(FirstActivity.this);

                alert.setTitle("提示");
                alert.setMessage("是否同意戴绿帽子");
                alert.setPositiveButton("ok", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        //点击确定
                        Log.d("lzp", "点击确定");

                    }
                });

                alert.setNegativeButton("cancle", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        Log.d("lzp", "点击取消");

                    }
                });
                alert.show();



            }

        });


    }

    public void progressdialogStart(View v) {

        ProgressDialog pdia = new ProgressDialog(FirstActivity.this);

        pdia.setTitle("菊花转转");
        pdia.setCancelable(true); //true点击back键能取消菊花

        pdia.show();
    }


}
